home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Programming / LEDA / prog / dict / set.c < prev    next >
C/C++ Source or Header  |  1994-08-05  |  508b  |  45 lines

  1. #include <LEDA/set.h>
  2.  
  3.  
  4. //void print(set<string> S, string s)
  5. void print(set<string>& S, string s)
  6. { cout << s;
  7.   forall(s,S) cout << s << " ";
  8.   newline;
  9.  } 
  10.  
  11. main()
  12. {
  13.  
  14. set<string> S, S1;
  15.  
  16.  
  17. string s;
  18.  
  19. while (cin >> s) 
  20.  { if (s == "stop") break;
  21.    S.insert(s);
  22.   }
  23.  
  24. S1 = S;
  25.  
  26. print(S, "S = ");
  27. print(S1,"S1 = ");
  28.  
  29. while (cin >> s) 
  30.    if (S1.member(s))
  31.    { cout << "delete " << s << "\n";
  32.      S1.del(s);
  33.     }
  34.    else cout << s << "  not in S1 \n";
  35.  
  36.  
  37. print(S, "S = ");
  38. print(S1,"S1 = ");
  39.  
  40.  
  41.  return 0;
  42.  
  43. }
  44.  
  45.